const { DataTypes } = require("sequelize");

const db = require("../dbConnect")

// 定义数据模型

module.exports = db.define("blog", {
    // 字段
    title: {
        type: DataTypes.STRING,
        allowNull: false
    },
    description: {
        type: DataTypes.TEXT,
        allowNull: false
    },
    toc: {
        type: DataTypes.TEXT,
        allowNull: false
    },
    htmlContent: {
        type: DataTypes.TEXT,
        allowNull: false
    },
    thumb: {
        type: DataTypes.STRING,
        allowNull: false
    },
    scanNumber: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    commentNumber: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    createDate: {
        type: DataTypes.STRING,
        allowNull: false
    },
    categoryId: {
        type: DataTypes.INTEGER,
        allowNull: false
    }
}, {
    freezeTableName: true, // 让默认不加s
    createdAt: false,
    updatedAt: false
})